<template>
  <div>
    <button @click="run('kilob')">重建索引</button>
    <button @click="run('performance')">重建效能</button>
  </div>
</template>
<script setup>
import { defineEmits } from 'vue'
import { resetKilob, resetPerformance } from '../api/rebuild.js'
const emit = defineEmits(['result'])
function run(type) {
  if (type === 'kilob') {
    resetKilob().then(res => emit('result', res)).catch(() => emit('result', '操作失败'))
  } else {
    resetPerformance().then(res => emit('result', res)).catch(() => emit('result', '操作失败'))
  }
}
</script>
